package com.achao.thread;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Author: achao
 * @DateTime: 2022/8/9 19:54
 * @Description: TODO
 */
public class ConnThread implements Runnable {

    private ServerSocket serverSocket;

    public ConnThread(ServerSocket serverSocket) {
        this.serverSocket = serverSocket;
    }

    @Override
    public void run() {
        while (true){
            try {
                Socket socket = serverSocket.accept();
                new Thread(new ReadThread(socket)).start();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
